import java.util.ArrayDeque;
import java.util.Deque;
import java.util.LinkedList;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DickYang
 * Date: 2023-07-10
 * Time: 10:46
 */
public class MyDequeTest {

    public static void main2(String[] args) {
        Deque<Integer> deque = new LinkedList<>();
        System.out.println("===头插法===");
        deque.offerFirst(1);
        deque.offerFirst(2);
        deque.offerFirst(3);

        System.out.println("===尾插法===");
        deque.offerLast(4);
        deque.offerLast(5);
        deque.offerLast(6);
        System.out.println("===头删法===");
        System.out.println(deque.pollFirst());
        System.out.println("===尾删法===");
        System.out.println(deque.pollLast());
        System.out.println("===查看头结点===");
        System.out.println(deque.peekFirst());
        System.out.println("===查看尾巴结点===");
        System.out.println(deque.peekLast());

    }
    public static void main1(String[] args) {
        MyDeque myQueue = new MyDeque();
        System.out.println("===尾插法===");
        myQueue.lastOffer(6);
        myQueue.lastOffer(7);
        myQueue.lastOffer(8);

        System.out.println("===头插法===");
        myQueue.headOffer(1);
        myQueue.headOffer(2);
        myQueue.headOffer(3);
        myQueue.headOffer(4);
        myQueue.headOffer(5);
        myQueue.display();

        System.out.println("===尾删法===");
        int num = myQueue.lastPoll();
        System.out.println(num);
        myQueue.display();

        System.out.println("===头删法===");
        int num1 = myQueue.headPoll();
        System.out.println(num1);
        myQueue.display();

        System.out.println("===查看头结点===");
        int num2 = myQueue.headPeek();
        System.out.println(num2);
        myQueue.display();

        System.out.println("===查看尾巴结点===");
        int num3 = myQueue.lastPeek();
        System.out.println(num3);
        myQueue.display();

        System.out.println("===查看队列的长度===");
        System.out.println(myQueue.size());

        System.out.println("===查看队列是否为空===");
        System.out.println(myQueue.isEmpty());
    }
}
